package com.tvunetworks.center.user.service;

import com.tvunetworks.center.common.model.GetTpcFeatureEnableParam;
import com.tvunetworks.center.common.model.LoginUser;
import com.tvunetworks.center.common.model.dto.GeoDetail;
import com.tvunetworks.center.common.util.Result;
import com.tvunetworks.center.user.model.param.CreateUserParam;

import java.io.IOException;
import java.util.List;
/**
 * @author Etan Yang
 * @data: 2021/6/4 19:05
 * @program: tvucc-aggregator
 * @description:
 */
public interface UserHttpService {
    /**
     *
     * @param session session
     * @return Result
     * @throws IOException 编译异常
     */
    Result<LoginUser> userserviceGetUserInfo(String session) throws IOException;

    /**
     *
     * @param session session
     * @return Result
     * @throws IOException 编译异常
     */
    Result<Void> userserviceLogout(String session) throws IOException;

    /**
     * 校验该session用户是否有登陆当前服务的权限
     * @param session session
     * @return Result
     * @throws IOException 编译异常
     */
    Result<Boolean> userserviceCheckServiceAccessable(String session) throws IOException;

    /**
     * 校验该session用户是否有登陆服务的权限
     * @param session session
     * @param serverName serverName
     * @return Result
     * @throws IOException 编译异常
     */
    Result<Boolean> userserviceCheckServiceAccessable(String session, String serverName) throws IOException;

    /**
     *
     * @param param param
     * @return Result
     * @throws IOException 编译异常
     */
    Result<List<String>> getTpcFeatureEnable(GetTpcFeatureEnableParam param) throws IOException;

    /**
     *
     * @param email email
     * @param token token
     * @return Result
     */
    Result<String> getUserRole(String email, String token);

    /**
     *
     * @param session session
     * @param email  email
     * @return Result
     */
    Result<String> getUserId(String session, String email);

    /**
     *
     * @param param param
     * @return Result
     */
    Result<String> userServiceCreateUser(CreateUserParam param);

    /**
     *
     * @param id id
     * @param active active
     * @return Result
     */
    Result<String> activateAndDisActivateUser(String id, String active);

    /**
     *
     * @param location location
     * @return Result
     */
    Result<String> getGeoNameByLocation(String location);

    /**
     *
     * @param ip ip
     * @return Result
     */
    Result<GeoDetail> getGeoNameByIp(String ip);

    /**
     * 通过address获取Geo信息
     * @param param param
     * @return Result
     */
    Result<String> getGetGeoLocationByAddress(String param);

    /**
     *
     * @param peerId peerId
     * @param latitude latitude
     * @param longitude longitude
     * @return Result
     */
    Result<String> sendGeoToTpds(String peerId, String latitude, String longitude);

    /**
     * 根据email和password获取session
     * @param email email
     * @param password 加密后的密码
     * @return Result
     */
    Result<String> getSession(String email, String password);

    /**
     *
     * @param rid rid
     * @param xid xid
     * @return Result
     */
    Result<String> addPairFromGCS(String rid, String xid);

    /**
     *
     * @param pairId pairId
     * @return Result
     */
    Result<String> removePairFromGCS(int pairId);

    /**
     *
     * @param rid rid
     * @param xid xid
     * @return boolean
     */
    boolean isRPairXFromGCS(String rid, String xid);
}
